package com.ruibang.glass.material.controller.cp;

import com.ruibang.glass.material.domain.req.bcp.BcpProductsInReq;
import com.ruibang.glass.material.entity.cp.MaterialCPProductsIn;
import com.ruibang.glass.material.entity.cp.MaterialCPProductsInInfo;
import com.ruibang.glass.material.service.cp.MaterialCPProductsInService;
import com.teaming.cloud.framework2.common.model.ResultBody;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * <p>
 * 批次查询 前端控制器
 * </p>
 *
 * @author mameng
 * @since 2024-02-05
 */
@RestController

@RequestMapping("/api/material/cp/product/in")
@Api(value="批次查询",tags={"批次查询"})
public class MaterialCPProductInController {


    @Autowired
    private MaterialCPProductsInService materialBcpProductsInService;

    @PostMapping("/list")
    @ApiOperation(value = "成品库存管理列表查询", response = ResultBody.class)
    public ResultBody getPageList(@RequestBody BcpProductsInReq bcpProductsInReq) {
        return ResultBody.success(materialBcpProductsInService.getPage(bcpProductsInReq));
    }

    @PostMapping("/add")
    @ApiOperation(value = "新增原材料入库", response = ResultBody.class)
    public ResultBody getPageList(@RequestBody MaterialCPProductsIn materialManagementReq) {
        return ResultBody.success(materialBcpProductsInService.save(materialManagementReq));
    }

    @GetMapping("/getOne/{id}")
    @ApiOperation(value = "获取对象", response = ResultBody.class)
    public ResultBody getMaterialBcpProductsInInfo(@PathVariable("id") String id) {
        MaterialCPProductsIn byId = materialBcpProductsInService.getById(id);
        return ResultBody.success(byId);
    }

}
